/**
 * Created by taojf on 16/7/18.
 */
class Tongji {
    loadScript(isprod, url,callback) {

        if (!isprod) {
            console.log('not prod env return');
            return;
        }

        var script = document.createElement("script");
        script.type = "text/javascript";
        if(typeof(callback) != "undefined"){
            if (script.readyState) {
                script.onreadystatechange = function () {
                    if (script.readyState == "loaded" || script.readyState == "complete") {
                        script.onreadystatechange = null;
                        callback();
                    }
                };
            } else {
                script.onload = function () {
                    callback();
                };
            }
        }
        script.src = url;
        document.body.appendChild(script);
    }
}

export default new Tongji()